item
The item to be passed to the Macro substitution delegate.
template
The template to process. This template string should contain macros in the form of ${macro_name}.
A string that results from all of the macros being processed in the template.
This example adds two macros to the macro processor and process a string.
using Leadtools.Dicom.Common.Anonymization;
public void MacroProcessorSample()
{
MacroProcessor<object> processor = new MacroProcessor<object>();
//
// add two macros to the macro processor
//
processor.Macros.Add("current_date", new MacroSubstitutionDelegate<object>(CurrentDateMacro));
processor.Macros.Add("current_time", new MacroSubstitutionDelegate<object>(CurrentTimeMacro));
//
// Process a macro string
//
Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}"));
}
private string CurrentDateMacro(object userData, string name, params object[] parameters)
{
return DateTime.Now.ToShortDateString();
}
private string CurrentTimeMacro(object userData, string name, params object[] parameters)
{
return DateTime.Now.ToShortTimeString();
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document